package com.iknow.maps;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import com.baidu.mapapi.MapView;
import com.iknow.activity.FriendActivity;
import java.util.ArrayList;

public class FriendsOverlay extends BalloonItemizedOverlay<IKnowOverlayItem>
{
  private Context mContext;
  private MapView mMapView;
  private ArrayList<IKnowOverlayItem> mOverlays = new ArrayList();

  public FriendsOverlay(MapView paramMapView, Drawable paramDrawable)
  {
    super(boundCenter(paramDrawable), paramMapView);
    this.mContext = paramMapView.getContext();
  }

  public void addOverlay(IKnowOverlayItem paramIKnowOverlayItem)
  {
    this.mOverlays.add(paramIKnowOverlayItem);
    populate();
  }

  public void clear()
  {
    this.mOverlays.clear();
  }

  protected IKnowOverlayItem createItem(int paramInt)
  {
    return ((IKnowOverlayItem)this.mOverlays.get(paramInt));
  }

  public int getCount()
  {
    return this.mOverlays.size();
  }

  protected boolean onBalloonTap(int paramInt, IKnowOverlayItem paramIKnowOverlayItem)
  {
    int i;
    if (paramIKnowOverlayItem.getFrined() == null)
      i = 1;
    while (true)
    {
      return i;
      Intent localIntent = new Intent(this.mContext, FriendActivity.class);
      localIntent.putExtra("friend", paramIKnowOverlayItem.getFrined());
      this.mContext.startActivity(localIntent);
      i = 1;
    }
  }

  public void setMapView(MapView paramMapView)
  {
    this.mMapView = paramMapView;
  }

  public int size()
  {
    return this.mOverlays.size();
  }
}